import 'package:flutter/material.dart';

class CheckBoxDemo extends StatefulWidget {
  CheckBoxDemo({Key key}) : super(key: key);

  @override
  _CheckBoxDemoState createState() => _CheckBoxDemoState();
}

class _CheckBoxDemoState extends State<CheckBoxDemo> {
  bool _checkboxItemActive = true;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('CheckBoxDemo'),
        elevation: 0.0,
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          CheckboxListTile(
            value: _checkboxItemActive, 
            onChanged: (value){
              setState(() {
                _checkboxItemActive = value;
              });
            },
            title: Text('checkbox item A'),
            subtitle: Text('checkbox item A'),
            secondary: Icon(Icons.bookmark),
            selected: _checkboxItemActive,
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Checkbox(
                value: _checkboxItemActive,   
                onChanged: (value){
                  setState(() {
                    _checkboxItemActive = value;
                  });
                },
                activeColor: Colors.black,
              ),
            ],
          )
        ],
      ),
    );
  }
}